
package gui;
import business.Pessoa;
import business.Reserva;
import business.Categoria;
import java.util.List;
import java.util.PropertyResourceBundle;
import java.util.Calendar;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import vo.ReservaVO;

public class Reserva_Apagar extends javax.swing.JPanel {

 
    public Reserva_Apagar() {
        initComponents();
        jTextFieldReservaApagarBuscarIDReserva.setText("");
        //updateReservas();
    }

    @SuppressWarnings("unchecked")
    
 
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTextFieldReservaApagarBuscarIDReserva = new javax.swing.JTextField();
        jLabelReservaApagarBuscarIDReserva = new javax.swing.JLabel();
        jButtonReservaApagarApagarReservaSelecionada = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();

        java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("gui/Bundle"); // NOI18N
        jLabelReservaApagarBuscarIDReserva.setText(bundle.getString("Reserva_Apagar.jLabelReservaApagarBuscarIDReserva.text")); // NOI18N

        jButtonReservaApagarApagarReservaSelecionada.setText(bundle.getString("Reserva_Apagar.jButtonReservaApagarApagarReservaSelecionada.text")); // NOI18N
        jButtonReservaApagarApagarReservaSelecionada.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonReservaApagarApagarReservaSelecionadaActionPerformed(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel1.setText(bundle.getString("Reserva_Apagar.jLabel1.text")); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jButtonReservaApagarApagarReservaSelecionada, javax.swing.GroupLayout.DEFAULT_SIZE, 427, Short.MAX_VALUE)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabelReservaApagarBuscarIDReserva)
                                .addGap(18, 18, 18)
                                .addComponent(jTextFieldReservaApagarBuscarIDReserva)))
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jLabel1)
                        .addGap(148, 148, 148))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(33, 33, 33)
                .addComponent(jLabel1)
                .addGap(74, 74, 74)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelReservaApagarBuscarIDReserva)
                    .addComponent(jTextFieldReservaApagarBuscarIDReserva, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(84, 84, 84)
                .addComponent(jButtonReservaApagarApagarReservaSelecionada, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(17, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonReservaApagarApagarReservaSelecionadaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonReservaApagarApagarReservaSelecionadaActionPerformed

      String apagar = jTextFieldReservaApagarBuscarIDReserva.getText();
      
      if(Reserva.ReservaExiste(apagar))
      {
          Reserva.DeleteReservaPeloID(apagar);
        jTextFieldReservaApagarBuscarIDReserva.setText("");         
      }
        else
      {
        JOptionPane.showMessageDialog(this,"Impossivel Apagar Reserva Inexistente");
        jTextFieldReservaApagarBuscarIDReserva.setText("");
      }
        // TODO add your handling code here:
    }//GEN-LAST:event_jButtonReservaApagarApagarReservaSelecionadaActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonReservaApagarApagarReservaSelecionada;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabelReservaApagarBuscarIDReserva;
    private javax.swing.JTextField jTextFieldReservaApagarBuscarIDReserva;
    // End of variables declaration//GEN-END:variables
}
